package com.study.authority;

public class TestInstanceof {
    public static void main(String[] args) {
        double d = 324.234;
        String name = "李四";
        //左边对象实例不能是基础数据类型
        //if(d instanceof Double)
        if(name instanceof String){
            System.out.println(true);
        }
        //左边对象实例和右边的类不在同一个继承树上
        //if(name instanceof Double)
        Z z = new Z();
        z.convert("yy");
    }
}
interface X{}
class Y implements X{}
class Z extends Y{
    private void print(Object x){
        System.out.println(x+" instanceof");
    }
    public void convert(String y){
        if(y instanceof Object){
            this.print(y);
        }
    }
}
